//
//  SWHomeVisitorView.swift
//  SinaWeibo
//
//  Created by wszyxc on 16/7/18.
//  Copyright © 2016年 wszyxc. All rights reserved.
//

import UIKit

class SWHomeVisitorView: UIView {
    
    //声明一个闭包
    var closure :(()->())?

    @IBOutlet weak var cycleView: UIImageView!
    
    @IBAction func attensionClick(sender: AnyObject) {
        
        //modal出登陆控制器
    
        closure?()
        
    }

    //提供类方法加载xib
    class func homeVisitor() -> SWHomeVisitorView {
        
        
        return NSBundle.mainBundle().loadNibNamed("SWHomeVisitorView", owner: nil, options: nil).last as! SWHomeVisitorView
    }

    override func awakeFromNib() {
        
        //给cycleView添加动画
        addAnima()
        
        //设置导航栏按钮
        
        
        
    }
    
    
    func addAnima(){
        
        let anima:CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
        
        anima.duration = 10
        
        anima.repeatCount = MAXFLOAT
        
        anima.toValue = M_PI * 2
        
        anima.removedOnCompletion =  false
        
        cycleView.layer.addAnimation(anima, forKey: nil)

        
    }
    


}
